<template>
	<view class="setUp">
		<view class="" style="height: 160rpx;">
			<view class="mail_List fixed z_ninetynine">
				<view class="mail" style="font-weight: 700;">
					<view class="order">退出登录</view>
				</view>
			</view>
			<view class="icon fixed z_ninetynine">
				<u-icon name="arrow-left" color="#fefefe" size="40" @click="navigateBack"></u-icon>
			</view>

		</view>
		<view class="">
			<view class="" style="width: 171rpx;color: #cccccc;margin: 50rpx auto 0;">
				当前版本1.0.0
			</view>
			<view class="" style="text-align: center;position: fixed;bottom: 80rpx;left: 0;right: 0;">
				<u-button type="success" size="medium" @click="logOut">退出登录</u-button>
			</view>
		</view>
		<!-- 弹框 -->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		onLoad() {
			this.loginId = uni.getStorageSync("setModel")
		},
		methods: {
			logOut() {
				this.$http.post('exitLogin', {
					userName:this.loginId.userName
				}).then(res => {
					if (res.code==200) {
						this.$refs.uToast.show({
							title: res.msg,
						})
						uni.removeStorageSync('token')
						uni.removeStorageSync('setModel')
						uni.removeStorageSync('plantNo')
						uni.removeStorageSync('userType')
						this.openUrl('/pagesB/sign/sign')
						
						// setTimeout(function() {
						// 	// console.log(111)
						// 	// this.$forceUpdate()
						// 	this.onLoad()
						// }, 1000);
					} else {
						this.$refs.uToast.show({
							title: res.msg,
						})
					}
					console.log(res)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.setUp {
		.mail_List {
			overflow: hidden;
			width: 100%;
			background-color: #f2f2f2;

			.mail {
				padding: 10rpx 0;
				// margin-top: 96rpx;
				color: #f2f2f2;
				font-size: 40rpx;
				background-color: #2e576f;
			}

			.order {
				text-align: center;
			}
		}
	}
</style>
